// web/src/app/learn/(dashboard)/_components/sidebar-routes.tsx
'use client';
import React from 'react';
import {BarChart, Compass, Layout, List} from "lucide-react";
import SidebarItem from "@/app/learn/(dashboard)/_components/sidebar-item";
import {usePathname, useRouter} from "next/navigation";

const guestRoutes = [
    {
        icon: Layout,
        label: "Dashboard",
        href: '/learn',
    },
    {
        icon: Compass,
        label: "Browse",
        href: '/learn/search'
    }
]

const teacherRoutes = [
    {
        icon: List,
        label: "Courses",
        href: '/learn/teacher/courses'
    },
    {
        icon: BarChart,
        label: "Analytics",
        href: '/learn/teacher/analytics'
    }
]

const SidebarRoutes = () => {
    const pathname = usePathname()
    const isTeacherPage = pathname?.replaceAll('/learn', '').startsWith('/teacher')
    const routes = isTeacherPage ? teacherRoutes : guestRoutes

    return (
        <div className={`flex flex-col w-full`}>
            {routes.map(r => (
                <SidebarItem
                    key={r.href}
                    icon={r.icon}
                    href={r.href}
                    label={r.label}
                />
            ))}
        </div>
    );
};

export default SidebarRoutes;